home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / ste / autoexec.lzh / SOURCE / MAKE_AEX.C < prev    next >
C/C++ Source or Header  |  1991-08-05  |  1KB  |  64 lines

  1. #include <tos.h>
  2. #include <string.h>
  3.  
  4.  
  5. long _get_bootdrv(void)
  6. {    return (long)*((int *)0x446);
  7. }
  8.  
  9. int das_boot(void)
  10. {    return (int)Supexec(_get_bootdrv);
  11. }
  12.  
  13.  
  14. char *auto_prgms = "A:\\AUTO\\*.PRG";
  15. char *auto_all = "A:\\AUTO\\*.PR?";
  16.  
  17. char *auto_new = "!A:\\NEW_AUTO\\";
  18.  
  19. main()
  20. {DTA file_info;
  21.  int boot_drv,end_of_file_list;
  22.  char line[50];
  23.  
  24.     Fsetdta(&file_info);
  25.     
  26.     boot_drv = das_boot();
  27.     auto_prgms[0] += boot_drv;
  28.     auto_all[0] += boot_drv;
  29.     auto_new[1] += boot_drv;
  30.     
  31.     auto_new[0] = '!'; /* put the execute command before all programs */
  32.  
  33.     Cconws("; First make a exit key. If you press SPACE before this\r\n"
  34.            "; the computer will start without autoprograms.\r\n"
  35.            "D* ; set some default key.\r\n"
  36.            "? X; if SPACE have been pressed, eXit\r\n\r\n"
  37.            "; Execute all the current active programs from the auto folder\r\n");
  38.     
  39.     end_of_file_list = Fsfirst(auto_prgms, 0);
  40.  
  41.     while (!end_of_file_list)
  42.     {    strncpy(line, file_info.d_fname, 14);
  43.         Cconws(auto_new);
  44.         Cconws(line);
  45.         Cconws("\r\n");
  46.         end_of_file_list = Fsnext();
  47.     }
  48.     
  49.     Cconws("\r\n; Now list all active and disabled programs.\r\n");
  50.     
  51.     auto_new[0] = ';'; /* put a comment before all programs */
  52.  
  53.     end_of_file_list = Fsfirst(auto_all, 0);
  54.  
  55.     while (!end_of_file_list)
  56.     {    strncpy(line, file_info.d_fname, 14);
  57.         Cconws(auto_new);
  58.         Cconws(line);
  59.         Cconws("\r\n");
  60.         end_of_file_list = Fsnext();
  61.     }
  62.  
  63.     return 0;
  64. }